/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sysmo.server;

/**
 *
 * @author Derek
 */
import javax.servlet.*;
import java.io.IOException;

public class ChFilter implements Filter {

    private String code = null;

    public void init(FilterConfig fc) throws ServletException {
        this.code = fc.getInitParameter("code");
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws ServletException, IOException {
        request.setCharacterEncoding(code);
        response.setContentType("text/html;charset=utf-8");
        chain.doFilter(request, response);
    }

    public void destroy() {
    }
}